package com.fm.demo.jet_pack

import android.content.Context
import android.os.Bundle
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import androidx.navigation.fragment.NavHostFragment
import com.blankj.utilcode.util.LogUtils
import com.fm.common.base.BaseBFragment
import com.fm.demo.R
import com.fm.demo.databinding.FragmentABinding
import com.fm.demo.utils.DialogUtils

/**
 * @CreateData:     2019/11/1 9:33
 * @E-Mail:         709674174@qq.com
 * @Author:         lyy
 * @Description:    navigation测试fragment
 */
class NavigationFragmentA : BaseBFragment<FragmentABinding>(), View.OnClickListener {


    override fun initView() {
        binding?.let {
            it.fragmentATv.setOnClickListener(this)
            it.fragmentABtnShowLoadingDialog.setOnClickListener(this)
        }
    }

    override fun onClick(v: View) {
        when (v.id) {
            R.id.fragment_a_tv -> {
                NavHostFragment.findNavController(this).navigate(R.id.action_fragmentA_to_fragmentB)
            }
            R.id.fragment_a_btn_show_loading_dialog->{
                DialogUtils.showLoadingDialog(context = mContext!!)
            }
        }
    }

    override fun onAttach(context: Context) {
        super.onAttach(context)
        LogUtils.e("fragment a onAttach")
    }

    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        LogUtils.e("fragment a onCreate")
    }

    override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View? {
        LogUtils.e("fragment a onCreateView")
        return super.onCreateView(inflater, container, savedInstanceState)
    }

    override fun onActivityCreated(savedInstanceState: Bundle?) {
        super.onActivityCreated(savedInstanceState)
        LogUtils.e("fragment a onActivityCreated")
    }

    override fun onStart() {
        super.onStart()
        LogUtils.e("fragment a onStart")
    }

    override fun onResume() {
        super.onResume()
        LogUtils.e("fragment a onResume")
    }

    override fun onPause() {
        super.onPause()
        LogUtils.e("fragment a onPause")
    }

    override fun onStop() {
        super.onStop()
        LogUtils.e("fragment a onStop")
    }

    override fun onDestroyView() {
        super.onDestroyView()
        LogUtils.e("fragment a onDestroyView")
    }

    override fun onDestroy() {
        super.onDestroy()
        LogUtils.e("fragment a onDestroy")
    }

    override fun onDetach() {
        super.onDetach()
        LogUtils.e("fragment a onDetach")
    }

}